Skip to content

Revert to minSdk 23 - #158

Open
LagradOst wants to merge 2 commits into
anggrayudi:masterfrom
LagradOst:master
Open

Revert to minSdk 23#158
LagradOst wants to merge 2 commits into
anggrayudi:masterfrom
LagradOst:master

Conversation

@LagradOst

Copy link
Copy Markdown

Fixes #157 by reverting parts of 4b77900

@anggrayudi anggrayudi changed the title Revert minsdk to minsdk23 Revert to minsdk23 Aug 18, 2026
@anggrayudi anggrayudi changed the title Revert to minsdk23 Revert to minSdk 23 Aug 18, 2026
@anggrayudi

Copy link
Copy Markdown
Owner

Thanks for the PR. I checked it out and ran the build. The direction is right and most of the revert is faithful to the pre-4b77900 code: :storage lint passes at minSdk 23 and the unit tests are green. One blocker and a few loose ends.

Blocker — CI fails. ./gradlew build test check stops at :sample:lintLocalDebug:

sample/src/main/AndroidManifest.xml:28: Error: <com.anggrayudi.storage.sample.screen.AccessScreen> requires API level 24 (current min is 23) [NewApi]

That comes from the @RequiresApi(N) you put on AccessScreen. An activity declared in the manifest can't require a higher API than the app's minSdk.

The fix, which is better anyway. The annotation on AccessScreen is only needed because StorageAccessManager is annotated at class level. But only two methods there actually touch API 24: resolveBookmark and createBookmark, both via StorageManager.getStorageVolumes(). Everything else — ensureAccess, pickFolder, pickFiles, createFile, requestPermission — works fine on 23. With the annotation on the class, none of those are usable at minSdk 23, which takes away most of what this PR is trying to give back.

So: move @RequiresApi(Build.VERSION_CODES.N) from the class down to resolveBookmark and createBookmark, and drop it from AccessScreen. I tried that locally and both :storage:lintDebug and :sample:lintLocalDebug pass.

Docs still say 26. README.md line 69, MIGRATION.md line 11, CONTRIBUTING.md line 8. Also, 4b77900 deleted the "only takes effect on API 26+" notes on the initialPath params in SimpleStorage.kt and SimpleStorageCompose.kt. The 26 guard is back, so those notes should come back too.

Nits.

  • StorageType.kt: the new import com.anggrayudi.storage.file.StorageType.Companion.fromStorageId is a self-import and isn't needed. Removing the unused SimpleStorage import is fine.
  • Some new lines run past 100 columns and aren't ktfmt-formatted (see CONTRIBUTING.md — ktfmt, Google style). DocumentFileCompat.kt was clean before this PR and isn't now.

One caveat on my side: none of this is exercised on a real API 23 device, so the restored pre-26 behaviour is verified by code review and lint only.

@anggrayudi

Copy link
Copy Markdown
Owner

Can you fix the compile error so we can merge?

@LagradOst

Copy link
Copy Markdown
Author

Can you fix the compile error so we can merge?

A yes, I assumed the first comment was ai generated with no actual human looking at the pr.

@LagradOst

Copy link
Copy Markdown
Author

This should fix the ktfmt and minsdk issues at least. I can also say that the lib works fine on minsdk23 at least when tested on my app with several <26 sdk users (apart from the standard issues with android storage that are impossible to fix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MinSdk 23?

2 participants